using UnityEngine;
using System.Collections;

public class ZoneViewTriggerOn : MonoBehaviour {
	
	#region Attributes
	
	private CameraControl camControl;
	public Vector3 zViewDist = Vector3.zero;
	
	#endregion
	
	void Start () {
		
		this.camControl = GameObject.FindGameObjectWithTag(TagConstants.TAG_PLAYER).GetComponentInChildren<CameraControl>();
	
	}
	
	
	void OnTriggerEnter (Collider other){
		
		
		if (other.gameObject.tag == TagConstants.TAG_PLAYER)
		{	
			
			Debug.Log("OnTriggerEnter");
			
			this.camControl.SetCameraZoneViewDistance(zViewDist);
			this.camControl.ChangeCameraStateTo(StateConstants.CAMERA_ZONE_VIEW_STATE);
			

		}
		
	}
	
	void OnTriggerExit (Collider other){
		
		
		if (other.gameObject.tag == TagConstants.TAG_PLAYER)
		{		
			
			Debug.Log("OnTriggerEnter");
		
			this.camControl.ChangeCameraStateTo(StateConstants.CAMERA_FOLLOW_STATE);
			

		}
		
	}

}
